#include "command.h"

int recv_command(sendc_t *sc, int netFD){

    int ret = recv(netFD, &(sc->num), sizeof(sc->num), MSG_WAITALL);
    ERROR_CHECK(ret, -1, "recv_num_recvCommand.c");
    if(ret == 0){
        return 0;
    }

    ret = recv(netFD, &(sc->path_size), sizeof(sc->path_size), MSG_WAITALL);
    ERROR_CHECK(ret, -1, "recv_pathsize_recvCommand.c");

    char buf[1024] = { 0 };
    ret = recv(netFD, buf, sc->path_size, MSG_WAITALL);
    ERROR_CHECK(ret, -1, "recv_path_recvCommand.c");

    strncat(sc->path, buf, sc->path_size);
    return 1;
}
